/*
 * @Description: 
 * @Author: 姜暖阳
 * @Date: 2021-07-08 15:10:26
 * @LastEditTime: 2021-11-12 13:09:16
 * @LastEditors: 姜暖阳
 * @Reference: 
 */
import { Method } from "axios";

class NYDefaultConfig {
    baseUrl: string; // 默认请求地址
    timeout: number; // 超时时间
    contentType: string; // 数据类型
    requestType: Method; // 请求方式
    useToken: boolean; // 是否使用token
    url: string; // 当前接口
    showSuccessMessage: boolean; //请求成功是否显示消息, 默认不显示
    showFailMessage: boolean; //请求失败是否显示消息，默认显示

    // constructor({baseUrl = process.env.VUE_APP_BaseURL, timeout = 60000, contentType = 'application/json;charset=UTF-8', requestType = 'post', useToken = true, url = ''}) {
    constructor({baseUrl = process.env.VUE_APP_BaseURL, timeout = 60000, contentType = 'application/json;charset=UTF-8', requestType = 'post', useToken = true, url = '', showSuccessMessage = false, showFailMessage = true}) {
        this.baseUrl = baseUrl;
        this.timeout = timeout;
        this.contentType = contentType;
        this.requestType = requestType as Method;
        this.useToken = useToken;
        this.url = url;
        this.showSuccessMessage = showSuccessMessage;
        this.showFailMessage = showFailMessage;
    }
}

export default NYDefaultConfig;